Skip to content

Latest commit

 

History

History
114 lines (73 loc) · 1.83 KB

File metadata and controls

114 lines (73 loc) · 1.83 KB

ROS Activities

ROS Logo

ROS Example 2: TurtleSim Example

The following example is to work with turtlesim node which is attached in ROS packages.

Compile packages

catkin_make

Run the ROS master node:

roscore

Run the turtlesim_node

rosrun turtlesim turtlesim_node

After running this command, you'll see a graphical representation for turtle.

Turtlesim Window

You'll notice that you can't control turtle movement.


Run the turtle_teleop_key

There is a built-in feature turtle_teleop_key that takes the keyboard input from the user and convert it to ROS msg that controls the turtle position:

rosrun turtlesim turtle_teleop_key

Now, you can control the turtle's position from your keyboard.

Take a look on the image below for drawing triangle using the turtle.

Turtlesim Window

Explore turtlesim_node info

Listing the nodes:

rosnode list
rosnode info /turtlesim

Explore turtle topics info

Listing the topics:

rostopic list

Listing the turtle command velocity topic:

rostopic info /turtle1/cmd_vel

Notice that the messages type of cmd_vel topic is geometry_msgs/Twist

Explore Twist message info

rosmsg show geometry_msgs/Twist

Exercises

Exercise 1

Explore info for Pose messages in turtlesim node.

Exercise 2

Try to figure out the purpose of this command:

rostopic echo /turtle1/cmd_vel